package demo1;

/**
 * 在多线程环境下测试懒汉模式
 */
public class DEMO_03 {
    public static void main(String[] args) {
        Thread[] threads=new Thread[10];
        for (int i = 0; i < threads.length ; i++) {
            threads[i]=new Thread(()->{
                SingleLazy instance= SingleLazy.get();
                System.out.println(instance);
            });
        }
        for (Thread t:threads
        ) {
            t.start();
        }
    }
}
